package com.dynamic.idea.quick.develop.plugin.utils;

/**
 *@Description:数字比较
 *@author liuzhenhuan
 *@date 2016年12月8日 上午10:19:10
 * 
 */
public class MyNumberUtils {

    public static boolean equals(Integer a, int b) {
        return a != null && a.intValue() == b;
    }
    public static boolean equals(int a, Integer b) {
    	return equals(b, a);
    }
    public static boolean equals(String a, Integer b) {
        return a == null ? b == null : String.valueOf(b).equals(a);
    }	
    public static boolean equals(Integer a, String b) {
    	return equals(b, a);
    }
    public static boolean equals(String a, Long b) {
    	return a == null ? b == null : String.valueOf(b).equals(a);
    }	
    public static boolean equals(Long a, String b) {
    	return equals(b, a);
    }
    
    public static boolean equals(Integer a, Integer b) {
    	return a == null ? b == null : a.equals(b);
    }
    public static boolean equals(Long a, Long b) {
    	return a == null ? b == null : a.equals(b);
    }
    public static boolean equals(Long a, long b) {
        return a != null && a.longValue() == b;
    }
    public static boolean equals(long a, Long b) {
    	return equals(b, a);
    }
    
    public static String toString(Integer a, String defaultValue) {
        return a == null ? defaultValue : a.toString();
    }
    
    /**
     * 不是NULL或0
     * @param number
     */
    public static boolean isNotNullAndZero(Integer number){
    	if (number==null) {
			return false;
		}
    	if (number.intValue()<=0) {
			return false;
		}
    	return true;
    }
    
    /**
     * 不是NULL或0
     * @param number
     */
    public static boolean isNullOrZero(Integer number){
    	if (number==null) {
    		return true;
    	}
    	if (number.intValue()<=0) {
    		return true;
    	}
    	return false;
    }
    /**
     * 不是NULL或0
     * @param number
     */
    public static boolean isNotNullAndZero(Long number){
    	if (number==null) {
    		return false;
    	}
    	if (number.longValue()<=0L) {
    		return false;
    	}
    	return true;
    }
    
    /**
     * 不是NULL或0
     * @param number
     */
    public static boolean isNullOrZero(Long number){
    	if (number==null) {
    		return true;
    	}
    	if (number.longValue()<=0L) {
    		return true;
    	}
    	return false;
    }
    
    

}
